<?php

namespace App\Modules\Diagnose\Models;


use Illuminate\Database\Eloquent\Model;

/**
 * Class Task 任务
 * @package App\Modules\Task\Models
 */
class OrderDiagnose extends Model
{
    protected $table = 'order_diagnose';

    protected $fillable = ['id', 'user_id', 'trade_no','diagnose_id', 'diagnose_group_id', 'type', 'amount', 'transaction_id', 'payment_source', 'pay_end_at', 'pay_time', 'create_ip', 'notify_data', 'created_at', 'updated_at', 'status','is_used','diagnose_type'];

    public function diagnose() {
        return $this->belongsTo(Graphic::class);
    }

    static function getList($param)
    {
        return self::where('status','>=',0)->paginate($param['size']);
    }


    static function getDetails($id)
    {
        return self::where('id',$id)->first();
    }

    static function add($param)
    {
        // TODO check
        return self::create($param);
    }
}